add_executable(pywrapper pywrapper.cpp)

spark_find_library(python311 REQUIRED python-3.11 python-3.11 python-3.11-embed)
# target_link_python311(pywrapper)

enable_testing()
set(PYTHON_LIBRARY /usr/lib/x86_64-linux-gnu/libpython3.11.so)
if (EXISTS ${PYTHON_LIBRARY})
    message(STATUS "Found python library: ${PYTHON_LIBRARY}")
    add_test(NAME TestPyWrapper 
        COMMAND pywrapper ${PYTHON_LIBRARY}
        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    )

    # add_custom_command(TARGET pywrapper POST_BUILD 
    #     COMMAND ldd pywrapper 
    #     COMMAND pywrapper ${PYTHON_LIBRARY}
    #     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    # )
endif()